import Mock from 'mockjs'
const Random = Mock.Random

Mock.setup({timeout: '300-700'});

Mock.mock('/api/bills', {
  "data|1-10": [{
    billno: Random.id(),
    customer: Random.cname(),
    wxname: Random.protocol(),
    billmoney: Random.string('number', 5),
    createdAt: Random.now(),
    status: '待发货'
  }]
})

Mock.mock('/api/bills/:id', {
  "data|1-10": [{
    billno: Random.id(),
    customer: Random.cname(),
    wxname: Random.protocol(),
    billmoney: Random.string('number', 5),
    createdAt: Random.now(),
    status: '待发货'
  }]
})

Mock.mock('/api/shops', {
  "data|1-10": [{
    shopname: Random.cword(3) + '的小店',
    customername: Random.cname(),
    wxname: Random.protocol(),
    receiver: Random.cname(),
    phone: Random.id(),
    address: Random.county(true)
  }]
})

Mock.mock('/api/shopinfo',
  {
    data: {
      shopname: Random.cword(3) + '的小店',
      customername: Random.cname(),
      wxname: Random.protocol(),
      receiver: Random.cname(),
      phone: Random.id(),
      address: Random.county(true)
    }
  }
)

Mock.mock('/api/inventory', {
  "data|1-10": [{
    image: Random.image('100x60'),
    goodsno: Random.id(),
    goodsname: Random.natural(5, 30) + '元槟榔',
    format: Random.natural(100, 200) + 'g',
    useful: Random.natural(1000, 9000),
    paper: Random.natural(1000, 9000)
  }]
})

Mock.mock('/api/statement', {
  "data|1-10": [{
    goodsno: Random.id(),
    goodsname: Random.natural(5, 30) + '元槟榔',
    type: Random.boolean() ? '入库' : '出库',
    goodsmoney: Random.natural(1000, 9000),
    number: Random.natural(1000, 9000),
    operater: Random.cname(),
    createdAt: Random.now()
  }]
})

Mock.mock('/api/stockin', {
  "data|1-10": [{
    "id|1-100": 1,
    type: '生产入库',
    creator: Random.cname(),
    creatTime: Random.now(),
    stockinPeople: Random.cname(),
    stockinTime: Random.now(),
    status: '待发货'
  }]
})

Mock.mock('/api/campaigner', {
  "data|1-10": [{
    "id|1-100": 1,
    wxId: Random.id(),
    wxname: Random.cname(),
    joinTime: Random.now(),
  }]
})


const pmoney = Random.natural(5, 30);
const pstatus = Random.boolean()
Mock.mock('/api/product', {
  "data|1-10": [{
    image: Random.image('100x60'),
    goodsno: Random.id(),
    goodsname: pmoney + '元槟榔',
    format: Random.natural(100, 200) + 'g',
    price: pmoney,
    createdAt: Random.now(),
    status: pstatus ? '待上架' : '已上架',
    pstatus: pstatus
  }]
})

Mock.mock('/api/productinfo',
  {
    data: {
      productId: Random.id(),
      pname: pmoney + '元槟榔',
      format: Random.natural(100, 200) + 'g',
      price: pmoney,
      "pic|1-3": [Random.image('100x60')],
      open: Random.boolean()
    }
  }
)
